home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / ghostscript / src / bnum.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  53 lines

  1. /* Copyright (C) 1990 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* bnum.h */
  20. /* Interface to Level 2 number readers */
  21. /* Requires stream.h */
  22.  
  23. /* Homogenous number array formats. */
  24. /* The default for numbers is big-endian. */
  25. #define num_int32 0            /* [0..31] */
  26. #define num_int16 32            /* [32..47] */
  27. #define num_float 48
  28. #define num_float_IEEE num_float
  29. #define num_float_native (num_float + 1)
  30. #define num_msb 0
  31. #define num_lsb 128
  32. #define num_is_lsb(format) ((format) >= num_lsb)
  33. #define num_is_valid(format) (((format) & 127) <= 49)
  34. /* Special "format" for reading from an array */
  35. #define num_array 256
  36.  
  37. /* Test the byte ordering of numbers on a stream */
  38. #define s_is_lsb(s) num_is_lsb(s->num_format)
  39. #define s_is_msb(s) !s_is_lsb(s)
  40.  
  41. /* Read from an array or encoded number array */
  42. extern    int    sread_num_array(P2(stream *, ref *));
  43. extern    uint    scount_num_stream(P1(stream *));
  44. extern    int    sget_encoded_number(P2(stream *, ref *));
  45.  
  46. /* Get/put a number with appropriate byte swapping */
  47. extern    int    sgetshort(P2(stream *, short *));
  48. extern    void    sputshort(P2(stream *, short));
  49. extern    int    sgetlong(P2(stream *, long *));
  50. extern    void    sputlong(P2(stream *, long));
  51. extern    int    sgetfloat(P2(stream *, float *));
  52. extern    void    sputfloat(P2(stream *, floatp));
  53.